-
Notifications
You must be signed in to change notification settings - Fork 69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tagQuery(tags)
for complex css selections and alterations
#208
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…cursive function
* Consolidate all notes to the top of the file * Move function docs within `tag_graph()`, similar to R6 documentation. Am told all docs will be hoisted up and processed in order * Add `$parents()` to return all ancestors * Add `$reset()` to reset the selected els to root * Rename `$walk(fn)` to `$each(fn)`; fn now calls `fn(els[[i]], i)` * Remove the rage-inducing "zero width spaces". aaaaaarg!!
…r prior detection
* Rename `$root*()` to `$graph*()` * Move in print method to support internals * When calling `$find("x")` if a match is found, it will spawn an additional walking of the tree
wch
reviewed
Apr 14, 2021
wch
reviewed
Apr 14, 2021
wch
reviewed
Apr 14, 2021
wch
reviewed
Apr 14, 2021
wch
reviewed
Apr 14, 2021
wch
reviewed
Apr 14, 2021
wch
approved these changes
Apr 14, 2021
wch
reviewed
Apr 14, 2021
…str for diagnostics
… Need to `unlist()`
schloerke
changed the title
Add
Add Apr 15, 2021
tagQuery(tags)
for a complex css selections and alterationstagQuery(tags)
for complex css selections and alterations
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This implementation is experimental and will probably change.
tagQuery(tags)
methodsSelect
$find(cssSelector)
: Find all tag elements matching the multi-elementcssSelector
$children(cssSelector = NULL)
: Update the selected elements to the selected elements direct children.$parent(cssSelector = NULL)
: Update the selected elements to the selected elements direct parents.$parents(cssSelector = NULL)
: Update the selected elements to all ancestors of the selected elements.$closest(cssSelector = NULL)
: Update the selected elements to closest ancestor (and including itself) of each of the selected elements.$siblings(cssSelector = NULL)
: Get the siblings of each element in the set of matched elements.$filter(fn)
: Update the selected elements iffn(selected_i)
returnsTRUE
$reset()
: Resets the selected elements to the top level (root) tags.Update
$addClass(class)
: Apps class(es) to each of the the selected elements.$removeClass(class)
: Removes a set of class values from all of the selected elements.$hasClass(class)
: Determine whether the selected elements have a given class. Returns a vector of logical values.$toggleClass(class)
: If the a class value is missing, add it. If a class value already exists, remove it.$addAttrs(...)
: Add named attributes to all selected children. Similar to [tagAppendAttributes()
].$removeAttrs(attrs)
: Removes the provided attributes in each of the selected elements.$emptyAttrs()
: Removes all attributes in each of the selected elements.$hasAttr(attr)
: Returns a vector whose values are whether the selected element contains the non-NULL
attribute.Adjust children
$append(...)
: Add all...
objects as children after any existing children to the selected elements. Similar to [tagAppendChildren()
]$prepend(...)
: Add all...
objects as children before any existing children to the selected elements. A variation of [tagAppendChildren()
]$empty()
: Remove all children in the selected elements. Use this method before calling$append(...)
to replace all selected elements' children.Adjust siblings
$after(...)
: Add all...
objects as siblings after each of the selected elements.$before(...)
: Add all...
objects as siblings before each of the selected elements.$replaceWith(...)
: Replace all selected elements with...
. This also sets the selected elements to an empty set.$remove(...)
: Remove all selected elements from thetagQuery()
object. The selected elements is set to an empty set.Generic methods
$each(fn)
: Perform functionfn
on each of the selected elements.Tag Query methods
$asTags(selected = TRUE)
: Converts all tag environments to tags.$root()
: Return all top level (root) tags environments.$selected()
: Returns a list of selected tag environments.$get(position)
: Returns the selected tag element at the positionposition
.$rebuild()
: Makes sure that all tags have been upgraded to tag environments.$print()
: Internal print method. Called byprint.htmltools.tag.query()
Current tag env design decisions